﻿@using Pyramid.Mvc.Html
@model IEnumerable<Pyramid.Models.PayeeRecord>

@{
	var data = Model.ToList();
	var groups = data.GroupBy(x => x.Project).ToList();
	var date = DateTime.Now.AddMonths(-1);
	var selYear = (int)ViewBag.Year;
	var selMonth = (int)ViewBag.Month;
}
<div class="pageHeader">
	@using (Html.BeginForm("MyList", "Achievement", FormMethod.Post, new {onsubmit = "return navTabSearch(this);", id = "pagerForm"}))
	{
		<div class="searchBar">
			<table class="searchContent">
				<tr>
					<td>年份：</td>
					<td>@Html.DropDownListForRange("year", 2010, date.Year, selYear)</td>
					<td>月份：</td>
					<td>@Html.DropDownListForRange("month", 1, 12, selMonth)</td>
					<td>
						<div class="buttonActive">
							<div class="buttonContent">
								<button type="submit">查询</button>
							</div>
						</div>
					</td>
				</tr>
			</table>
		</div>
	}
</div>
<div class="pageContent">
	<table class="table" width="100%" layouth="110">
		<thead>
			<tr>
				<th>@Html.DisplayNameFor(m=>m.Amount)</th>
				<th>@Html.DisplayNameFor(m=>m.PayerType)</th>
				<th>@Html.DisplayNameFor(m=>m.PayerName)</th>
				<th>@Html.DisplayNameFor(m=>m.FinanceAccountId)</th>
				<th>@Html.DisplayNameFor(m=>m.ApplyTime)</th>
				<th>@Html.DisplayNameFor(m=>m.Verify.VerifyUserId)</th>
				<th>@Html.DisplayNameFor(m=>m.Verify.VerifyTime)</th>
				<th>@Html.DisplayNameFor(m=>m.Verify.VerifyRemark)</th>
			</tr>
		</thead>
		<tbody>
			<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
			<tr><td colspan="8">@selYear 年 @selMonth 月份业绩总计：@data.Sum(x=>x.Amount).ToString("C")</td></tr>
			<tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>
			@foreach (var g in groups)
			{
				<tr>
					<td colspan="8"><strong>收款项目类型：@g.Key.Name</strong>&nbsp;&nbsp;&nbsp;&nbsp;小计：@g.Sum(x => x.Amount).ToString("C")</td>
				</tr>
				foreach (var item in g)
				{
					<tr>
						<td>@item.Amount.ToString("C")</td>
						<td>@item.PayerTypeString</td>
						<td>@item.PayerName</td>
						<td>@item.FinanceAccount.Account</td>
						<td>@item.ApplyTime.ToString("yyyy-MM-dd")</td>
						<td>@item.Verify.VerifyUserId</td>
						<td>@item.Verify.VerifyTime.ToString("yyyy-MM-dd")</td>
						<td>@item.Verify.VerifyRemark</td>
					</tr>
				}
			}
		</tbody>
	</table>
</div>